#yy修改添加
#修改查看
#修改函数
import pymysql.connections
def update():
    # 获取连接
    conn = pymysql.connections.Connection(host="127.0.0.1",user="root",passwd="root",db="test",port=3306,charset="utf8")
    #获取游标对象
    cursor = conn.cursor()
    #定义sql语句
    sql = "update user set salary = salary+2000 where salary<5000"
    #执行sql
    cursor.execute(sql)
    #提交事务
    conn.commit()
    # 关闭游标对象和连接对象
    cursor.close()
    conn.close()

def delete():
    # 获取连接
    conn = pymysql.connections.Connection(host="127.0.0.1",user="root",passwd="root",db="test",port=3306,charset="utf8")
    #获取游标对象
    cursor = conn.cursor()
    #定义sql语句
    sql = "delete from user where salary=5000"
    #执行sql
    cursor.execute(sql)
    #提交事务
    conn.commit()
    # 关闭游标对象和连接对象
    cursor.close()
    conn.close()

if __name__ == '__main__':
    # update()
    delete()